//
//  FirstPageView.swift
//  KoiAccounting
//
//  Created by 纪洪文 on 02.04.25.
//

import SwiftUI

struct FirstPageView: View {
    @Binding var path: NavigationPath
    
    var body: some View {
        VStack(spacing: 20) {
            // 下拉指示器
            Capsule()
                .fill(Color.gray.opacity(0.3))
                .frame(width: 36, height: 5)
                .padding(.top, 8)
            
            Text("First Page")
                .font(.title)
            
            Button("Navigate to Next Page") {
                path.append("Page 2")
            }
            .buttonStyle(.borderedProminent)
            
            Spacer()
        }
        .frame(maxWidth: .infinity)
        .background(Color(uiColor: .systemBackground))
    }
}

struct SubPageView: View {
    let title: String
    @Binding var path: NavigationPath
    
    var body: some View {
        VStack(spacing: 20) {
            Capsule()
                .fill(Color.gray.opacity(0.3))
                .frame(width: 36, height: 5)
                .padding(.top, 8)
            
            Text(title)
                .font(.title)
            
            Button("Next Page") {
                path.append("Page \(path.count + 2)")
            }
            .buttonStyle(.borderedProminent)
            
            Button("Back") {
                path.removeLast()
            }
            .buttonStyle(.bordered)
            
            Spacer()
        }
        .frame(maxWidth: .infinity)
        .background(Color(uiColor: .systemBackground))
    }
}
